/// 检查节点是否是副本
pub fn is_replica(&self, node_id: &str) -> bool {
    self.replica_nodes.contains(&node_id.to_string())
}

async fn rebalance_partitions(&self) -> Result<()> {
    // 获取集群成员列表
    let members = self.cluster.get_members().await?;
    if members.is_empty() {
        return Ok(());
    }
    
    // 获取分区总数，在移出partitions前记录
    let partitions = self.partitions.read().await;
    let partitions_count = partitions.len();
    let members_count = members.len(); 
    
    // 处理分区重新平衡
    for (partition_id, partition) in partitions.iter() {
        // ... existing code ...
        
        // 省略中间逻辑 ...
        
        // 更新分区表 - 在这里创建一个新的作用域来释放读锁
        {
            // 释放读锁
            drop(partitions);
            // 获取写锁
            let mut partitions_write = self.partitions.write().await;
            partitions_write.insert(*partition_id, partition);
        }
        
        // 重新获取读锁继续处理下一个分区
        let partitions = self.partitions.read().await;
        // ... existing code ...
    }
    
    info!("Rebalanced {} partitions across {} nodes", partitions_count, members_count);
    Ok(())
} 